<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
  <link rel="icon" href="http://www.jd.com/favicon.ico">
  <title>用户-登录</title>
  <link href="/static/css/login.css" type="text/css" rel="stylesheet">
</head>
<body>
<header>
  <!--<img src="../static/images/logo.jpg">-->
</header>
<section>
  <div id="form">
    <h1>用户登录</h1>
    <p><input type="text" name="userName" maxlength="16" placeholder="输入用户名"/></p>
    <p><input type="password" name="password" maxlength="16" placeholder="输入密码"/></p>
    <p><span id="message"></span></p>
    <p><input id="submit" type="button" value="登录" style="height: 40px;"/></p>
  </div>

</section>
</body>
<script src="/static/js/jquery-1.12.4.js"></script>
<script src="/static/js/login.js"></script>
<script type="text/javascript">
  $(function () {

    //登录按钮点击
    $("#submit").click(function () {
      var userName = $("[name='userName']").val();
      var password = $("[name='password']").val();
      if (userName == "") {
        $message.text("用户名不能为空");
        return false;
      } else if (password == "") {
        $message.text("密码不能为空");
        return false;
      }
      loginByAjax(userName, password);
    });

  });
</script>
</html>